<!--
 * @Description: 
 * @Author: lwx
 * @Date: 2022-11-07 14:14:29
 * @LastEditors: lwx
 * @LastEditTime: 2022-12-09 14:13:32
-->
<template>
  <div class="pagination">
    <el-pagination
      v-if="paginations.pageTotal > 0"
      background
      :page-sizes="paginations.pageSizes"
      :page-size="paginations.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="paginations.pageTotal"
      :current-page="paginations.index"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "pagination",
  data() {
    return {};
  },
  props: {
    paginations: {
      type: Object,
      default: () => ({}),
    },
  },
  created() {},
  mounted() {},
  methods: {
    // 上下分页 pageIndex
    handleCurrentChange(page) {
      this.$emit("handleCurrentChange", page);
    },
    // 每页多少条切换 pageSize
    handleSizeChange(page_size) {
      this.$emit("handleSizeChange", page_size);
    },
  },
};
</script>

<style lang="scss" scoped>
.pagination {
  text-align: center;
  padding: 20px 0 10px;
}

</style>
